package com.nativetalk.controller.app.three.comment;

import com.nativetalk.base.Page;
import com.nativetalk.base.RetInfo;
import com.nativetalk.common.Constants;
import com.nativetalk.common.util.JsonUtil;
import com.nativetalk.controller.app.three.study.ThreeStudyController;
import com.nativetalk.service.three.comment.ThreeCommentService;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * Created by lizhun on 15/12/9.
 */
@Controller
public class ThreeCommentController {
    private static Logger logger = Logger.getLogger(ThreeCommentController.class);
    @Resource
    private ThreeCommentService threeCommentService;

    /**
     * @return RetInfo
     * @Purpose 查找老师评价列表
     * @version 3.2
     * @time    2015-08-23
     * @author lizhun
     */
    @RequestMapping(value = "/app/8/teacher/comment/list", method = {RequestMethod.GET, RequestMethod.POST}, consumes = "application/json")
    @ResponseBody
    public RetInfo list(@RequestBody Page page) {
        try {
            //打印入参
            logger.info(Constants.prefix_in + JsonUtil.toJson(page));

            RetInfo retInfo;
            retInfo = threeCommentService.findCommentByTeaId(page);

            //打印出参
            logger.info(Constants.prefix_out + JsonUtil.toJson(retInfo));
            return retInfo;
        } catch (Exception e) {
            //记录错误日志
            RetInfo retInfo = RetInfo.getServerErrorInfo();
            logger.error(e.getMessage(), e);

            //打印出参
            logger.error(Constants.prefix_out + JsonUtil.toJson(retInfo));
            return retInfo;
        }

    }
}


